﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace 项目框架
{
    public class Data : INotifyPropertyChanged
    {
        private bool status;
        public string Text
        {
            get; set;
        }
        public bool Status
        {
            get => status;
            set
            {
                if (value != status || Text == null)
                {
                    status = value;
                    Text = value ? "True" : "False";
                    TriggerPropertyChangeEvent("Text");
                }
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void TriggerPropertyChangeEvent(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
    public class Data1

    {
        public delegate void a(bool b1,string s1, string s2, string s3, string s4);
        public event a  Aevent;
        private bool status;
        public string StartTime
        {
            get; set;
        }
        public string EndTime
        {
            get; set;
        }
        public string AlarmText
        {
            get; set;
        }
        public string SN
        {
            get; set;
        }
        public bool Status
        {
            get => status;
            set
            {
                if (value != status)
                {
                    status = value;
                    if (!value)
                    {
                        EndTime = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss:FFFFFFF");
                        Aevent(Status, SN, StartTime, EndTime, AlarmText);
                    }
                    else
                    {
                        StartTime = DateTime.Now.ToString("yyyy-MM-dd'T'HH:mm:ss:FFFFFFF");
                        Aevent(Status, SN, StartTime, EndTime, AlarmText);
                    }
                }
            }
        }
    }
}